//
//  StDataShare.m
//  Xspcf
//
//  Created by 小小算盘 on 16/7/21.
//  Copyright © 2016年 小小算盘. All rights reserved.
//

#import "StDataShare.h"

@interface StDataShare ()
@property(nonatomic,strong)UIView *alert;
@property(nonatomic,strong)UIView *black;
@end

@implementation StDataShare

+(WyAlertView*)ShareAlertView{
    id temp=[[UIApplication sharedApplication] delegate];
    if (temp&&[temp isKindOfClass:[AppDelegate class]]) {
        AppDelegate * appdelegate=temp;
        if (!(appdelegate.msg_view)) {
            CGFloat h=KScreenH-44-20;
            appdelegate.msg_view=[[WyAlertView alloc] initWithFrame:CGRectMake(50, h-280, KScreenW -  100, 100)];
        }
        WyAlertView * alertview=(appdelegate.msg_view);
        return alertview;
    }
    return nil;
}

- (void)showAlertView:(UIView *)alertView inMain:(UIView *)mainView{
    [self hideAlertView];
    self.alert = alertView;
    self.black = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenW, KScreenH)];
    self.black.backgroundColor = [UIColor blackColor];
    self.black.alpha = 0.7;
    [mainView addSubview:self.black];
    [mainView addSubview:self.alert];
}

- (void)hideAlertView{
    [self.alert removeFromSuperview];
    [self.black removeFromSuperview];
    self.alert = nil;
    self.black = nil;
}

@end
